﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class SoundUI : MonoBehaviour {
	public Sprite on, off;
	void Start(){
		turn (Save.getSound ());
	}

	public void onClick(){
		SoundSystem.ins.onClick ();
		turn(SoundSystem.isPlaySound);
	}


	void turn(bool isOn){
		SoundSystem.ins.turn (isOn);
		bool isPlaySound = SoundSystem.isPlaySound;
		if (isPlaySound) {
			if (off != null) {
				//off.SetActive (false);
                GetComponent<Image>().sprite = on;
			}
		} else {
			if (off != null) {
				//off.SetActive (true);
                GetComponent<Image>().sprite = off;
			}
		}
	}

}
